package com.zhhs.galaxyott.adapters;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.zhhs.galaxyott.R;
import com.zhhs.galaxyott.utils.Logs;

public class HomeMovieListAdapter extends BaseAdapter {

    private Context context;
    private List<String> list;

    private TextView movie_name;
    private int selectPosition = 0;

    public HomeMovieListAdapter(Context context, List<String> list) {

        this.context = context;
        this.list = list;

    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int arg0) {
        return list.get(arg0);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        convertView = LayoutInflater.from(context).inflate(R.layout.homepage_list_item, null);

        movie_name = (TextView) convertView.findViewById(R.id.moviename);

        Logs.logD("DEBUG_GG", "THIS IS KEYCODE_DPAD_LEFT+GETVIEW");
        movie_name.setText(list.get(position));

        return convertView;
    }

    public void setSelectPosition(int position) {
        this.selectPosition = position;
        notifyDataSetChanged();
    }

}
